package com.qk.mapper;

import com.qk.entity.Dept;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {
    @Insert("insert into dept(name,status,create_time,update_time) values(#{name},#{status},#{createTime},#{updateTime})")
    void insert(Dept dept);

    // 查询部门列表
    List<Dept> selectList(String name, Integer status);

    // 根据 ID 查询部门
    @Select("select id, name, status, create_time, update_time from dept where id = #{id}")
    Dept selectById(Integer id);

    // 修改部门
    //@Update("update dept set name = #{name}, status = #{status}, update_time = #{updateTime} where id = #{id}")
    void updateById(Dept dept);

    // 根据 ID 删除部门
    @Delete("delete from dept where id = #{id}")
    void deleteById(Integer id);

    // 查询所有部门
    @Select("select id, name, status, create_time, update_time from dept where status = 1")
    List<Dept> selectAll();
}
